<template>
    <div>
        <!-- 面包屑导航 -->
         <el-bread></el-bread>
        <!-- 添加按钮 -->
    <el-button @click="addDialog" plain class="btn" type="primary" size="small">添加</el-button>
    <!-- 列表的渲染 -->
     <v-list @edit="edit"></v-list>
     <!--点击弹框 -->
     <v-dialog ref="digInfo" :isshow = 'isshow' :isAdd = 'isAdd' @cancel="cancel"></v-dialog>
    </div>
</template>

<script>
import vList from './list.vue'
import vDialog from './dialog.vue'
export default {
    data() {
        return {
           isshow:false,  //用于判断弹框是否显示
           isAdd:true  //用于判断是新增还是编辑
        };
    },
    components:{
        vList,
        vDialog
    },
    methods:{
        addDialog(){
            //打开弹框
            this.isshow = true
            // 告诉弹框是新增
            this.isAdd = true
        },
       cancel(e){
           this.isshow = e
       },
       edit(e){
           //打开弹框
            this.isshow = true
             // 告诉弹框是编辑
            this.isAdd = false
            this.$refs.digInfo.lookup(e)
       }
    }
};
</script>

<style scoped>
.btn{
      margin: 10px 5px;
}
</style>
